Conversation
Replace calls to `setContext` and `getContext` with type-specific accessor functions created by `createContext` [1]. Update the Bookmark and Folder component tests to use dedicated wrapper components that set the context using the typed accessor functions. Remove the legacy generic `ContextWrapper` wrapper component. [1] sveltejs/svelte#16948
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the codebase from generic Svelte context APIs to type-safe context management using the new createContext function available in Svelte 5.40.1.
- Updates Svelte version to 5.40.1 to access the new
createContextAPI - Replaces all
setContext/getContextcalls with typed context accessor functions - Creates dedicated test wrapper components for Bookmark and Folder components that use the typed context setters
Reviewed Changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updates Svelte version from 5.39.11 to 5.40.1 |
| src/treetop/context.ts | Creates typed context accessor functions using createContext |
| src/treetop/Treetop.svelte | Replaces setContext calls with typed setter functions |
| src/treetop/Folder.svelte | Replaces getContext calls with typed getter functions |
| src/treetop/Bookmark.svelte | Replaces getContext calls with typed getter functions |
| test/utils/BookmarkWrapper.svelte | New wrapper component for testing Bookmark with typed context |
| test/utils/FolderWrapper.svelte | New wrapper component for testing Folder with typed context |
| test/utils/ContextWrapper.svelte | Removes legacy generic context wrapper |
| src/treetop/Bookmark.svelte.test.ts | Updates test to use BookmarkWrapper instead of ContextWrapper |
| src/treetop/Folder.svelte.test.ts | Updates test to use FolderWrapper instead of ContextWrapper |
| src/treetop/Treetop.svelte.test.ts | Simplifies test by removing ContextWrapper usage |
| src/options/Options.svelte.test.ts | Simplifies test by removing ContextWrapper usage |
| eslint.config.js | Removes ContextWrapper from ESLint ignore list |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
createContextavailable.setContextandgetContextwith type-specific accessor functions created bycreateContext.ContextWrapperwrapper component.